<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddColumnFieldStepUpstreamInTable extends AbstractMigration
{
    public function up()
    {
        $this->table('step_upstream')
            ->addColumn('relation', 'string', ['limit' => 45, 'default' => '', 'comment' => '上游关系:开始(start),交付(delivery),关联(relation)'])
            ->addColumn('relation_type', 'string', ['limit' => 45, 'default' => '', 'comment' => '关联类型:集(episode),实体(entity),关联(relation)'])
            ->addColumn('project_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '项目ID'])
            ->addColumn('step_workflow_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '工序流id'])
            ->addColumn('upstream_step_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '上游工序id'])
            ->save();
    }

    public function down()
    {
        $this->table('step_upstream')
            ->removeColumn('relation')
            ->removeColumn('relation_type')
            ->removeColumn('project_id')
            ->removeColumn('step_workflow_id')
            ->removeColumn('upstream_step_id')
            ->save();
    }
}
